<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.20"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libxlsxwriter: Frequently Asked Questions</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">libxlsxwriter
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.20 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="PageDoc"><div class="header">
  <div class="headertitle">
<div class="title">Frequently Asked Questions </div>  </div>
</div><!--header-->
<div class="contents">
<div class="toc"><h3>Table of Contents</h3>
<ul><li class="level1"><a href="#faq_template">Q. Can Libxlsxwriter use an existing Excel file as a template?</a></li>
<li class="level1"><a href="#faq_formula_zero">Q. Why do my formulas show a zero result in some, non-Excel applications?</a></li>
<li class="level1"><a href="#faq_range_format">Q. Can I apply a format to a range of cells in one go?</a></li>
<li class="level1"><a href="#faq_msvc">Q. Is Visual C++ on Windows supported?</a></li>
<li class="level1"><a href="#faq_features">Q. Is feature X supported or will it be supported?</a></li>
<li class="level1"><a href="#faq_autofit">Q. Is there an &quot;AutoFit&quot; option for columns?</a></li>
<li class="level1"><a href="#faq_faq">Q. Do people actually ask these questions frequently, or at all?</a></li>
</ul>
</div>
<div class="textblock"><p>The section outlines some answers to some frequently asked questions.</p>
<h1><a class="anchor" id="faq_template"></a>
Q. Can Libxlsxwriter use an existing Excel file as a template?</h1>
<p>No.</p>
<p>Libxlsxwriter is designed only as a file <em>writer</em>. It cannot read or modify an existing Excel file.</p>
<h1><a class="anchor" id="faq_formula_zero"></a>
Q. Why do my formulas show a zero result in some, non-Excel applications?</h1>
<p>Due to wide range of possible formulas and inter-dependencies between them <code>libxlsxwriter</code> doesn't, and realistically cannot, calculate the result of a formula when it is written to an XLSX file. Instead, it stores the value 0 as the formula result. It then sets a global flag in the XLSX file to say that all formulas and functions should be recalculated when the file is opened.</p>
<p>This is the method recommended in the Excel documentation and in general it works fine with spreadsheet applications. However, applications that don't have a facility to calculate formulas, such as Excel Viewer, or several mobile applications, will only display the 0 results.</p>
<p>If required, it is also possible to specify the calculated result of the formula using the <a class="el" href="worksheet_8h.html#af474c01f7ec8ac1a01206c9c4a5867af" title="Write a formula to a worksheet cell with a user defined numeric result.">worksheet_write_formula_num()</a> function.</p>
<div class="fragment"><div class="line"><a class="code" href="worksheet_8h.html#af474c01f7ec8ac1a01206c9c4a5867af">worksheet_write_formula_num</a>(worksheet, 0, 0, <span class="stringliteral">&quot;=2 + 2&quot;</span>, NULL, 4);</div>
</div><!-- fragment --><dl class="section note"><dt>Note</dt><dd>LibreOffice doesn't recalculate Excel formulas that reference other cells by default, in which case you will get the default XlsxWriter value of 0. You can work around this by setting the "LibreOffice Preferences -&gt;
LibreOffice Calc -&gt; Formula -&gt; Recalculation on File Load" option to "Always
recalculate" (see the LibreOffice <a href="https://help.libreoffice.org/6.4/en-US/text/scalc/01/06080000.html?DbPAR=CALC">documentation</a>). Or, you can set a blank string result in the formula, which will also force recalculation:</dd></dl>
<div class="fragment"><div class="line"><a class="code" href="worksheet_8h.html#ae55a1d5b4956a8e07ff721ecd80dde95">worksheet_write_formula_str</a>(worksheet, 0, 0, <span class="stringliteral">&quot;=Sheet1!$A$1&quot;</span>, NULL, <span class="stringliteral">&quot;&quot;</span>);</div>
</div><!-- fragment --><h1><a class="anchor" id="faq_range_format"></a>
Q. Can I apply a format to a range of cells in one go?</h1>
<p>Currently no. However, it is a planned features to allow cell formats and data to be written separately.</p>
<h1><a class="anchor" id="faq_msvc"></a>
Q. Is Visual C++ on Windows supported?</h1>
<p>Yes. See <a class="el" href="getting_started.html#gsg_vcpkg">Using libxlsxwriter in Microsoft Visual Studio via vcpkg</a>.</p>
<h1><a class="anchor" id="faq_features"></a>
Q. Is feature X supported or will it be supported?</h1>
<p>All supported features are documented. In time the feature set may expand to include more of the functionality of the <a href="https://xlsxwriter.readthedocs.io">Python XlsxWriter</a> module.</p>
<h1><a class="anchor" id="faq_autofit"></a>
Q. Is there an "AutoFit" option for columns?</h1>
<p>Unfortunately, there is no way to specify "AutoFit" for a column in the Excel file format. This feature is only available at runtime from within Excel. It is possible to simulate "AutoFit" by tracking the width of the data in the column as your write it.</p>
<h1><a class="anchor" id="faq_faq"></a>
Q. Do people actually ask these questions frequently, or at all?</h1>
<p>Apart from this question, yes.</p>
<p>Next: <a class="el" href="bugs.html">Known Issues and Bugs</a> </p>
</div></div><!-- contents -->
</div><!-- PageDoc -->
<div class="ttc" id="aworksheet_8h_html_af474c01f7ec8ac1a01206c9c4a5867af"><div class="ttname"><a href="worksheet_8h.html#af474c01f7ec8ac1a01206c9c4a5867af">worksheet_write_formula_num</a></div><div class="ttdeci">lxw_error worksheet_write_formula_num(lxw_worksheet *worksheet, lxw_row_t row, lxw_col_t col, const char *formula, lxw_format *format, double result)</div><div class="ttdoc">Write a formula to a worksheet cell with a user defined numeric result.</div></div>
<div class="ttc" id="aworksheet_8h_html_ae55a1d5b4956a8e07ff721ecd80dde95"><div class="ttname"><a href="worksheet_8h.html#ae55a1d5b4956a8e07ff721ecd80dde95">worksheet_write_formula_str</a></div><div class="ttdeci">lxw_error worksheet_write_formula_str(lxw_worksheet *worksheet, lxw_row_t row, lxw_col_t col, const char *formula, lxw_format *format, const char *result)</div><div class="ttdoc">Write a formula to a worksheet cell with a user defined string result.</div></div>
<!-- HTML footer for doxygen 1.8.20-->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Copyright 2014-2020 John McNamara.
Generated by&#160;<a href="http://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.8.20
</small></address>
</body>
</html>
